#ifndef REDIS_CLIENT_H
#define REDIS_CLIENT_H

#include <drogon/HttpController.h>

using namespace drogon;

class RedisCtrl : public drogon::HttpController<RedisCtrl> {
public:
	METHOD_LIST_BEGIN
	// http://localhost:8090/r/key1
	ADD_METHOD_TO(RedisCtrl::get, "/r/{1}", Get);
	// http://localhost:8090/redisctrl/key1
	METHOD_ADD(RedisCtrl::get, "{1}", Get);
	METHOD_ADD(RedisCtrl::post, "{1}", Post);
	METHOD_LIST_END

	void get(const HttpRequestPtr &req,
			std::function<void(const HttpResponsePtr &)> &&callback,
			const std::string &key);

	void post(const HttpRequestPtr &req,
			std::function<void(const HttpResponsePtr &)> &&callback,
			const std::string &key);
};

#endif // REDIS_CLIENT_H